package cn.shutdown.demo.thread.suspend.nosync;

/**
 * 测试suspend的不同步情况
 * @author jiangwujie
 * @date 2021/8/8
 */
public class MyObject {

    private String username = "defaultUsername";

    private String password = "defaultPassword";

    public void setUserNameAndPassword(String username, String password) {
        this.setUsername(username);
        if (Thread.currentThread().getName().equals("a")) {
            Thread.currentThread().suspend();
        }
        this.setPassword("12345678");
    }

    public void printUsernameAndPassword() {
        System.out.println(this.getUsername() + " " + this.getPassword());
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
